{% extends 'base.html' %}
{% from 'bootstrap/pagination.html' import render_pagination %}
{% from 'macros.html' import post_card with context %}

{% block title %}
    管理文章
{% endblock %}

{% block content %}
    <div class="row">
        <div class="col-md-12">
            {# 展示个人中心的文章卡片 #}
            {% if posts %}
                {# 遍历所有posts #}
                {% for post in posts %}
                    {{ post_card(post) }}
                {% endfor %}
            {% else %}
                <div class="tip">
                    <h5>现在没有文章哦!</h5>
                    {% if current_user.is_authenticated %}
                        <a href="{{ url_for('user.new_post') }}">写文章</a>
                    {% endif %}
                </div>
            {% endif %}
        </div>
    </div>
    {#    文章分页#}
    {% if posts %}
        <div class="page-footer">
            {# 进行照片分页操作#}
            {{ render_pagination(pagination,align='center') }}
        </div>
    {% endif %}
{% endblock %}
